#if !defined(AFX_LISTCTRLEX_H__DFA9A34B_1296_40F7_8406_03D605C7B7F5__INCLUDED_)
#define AFX_LISTCTRLEX_H__DFA9A34B_1296_40F7_8406_03D605C7B7F5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ListCtrlEx.h : header file
//
#include "HeaderCtrlEx.h"

/////////////////////////////////////////////////////////////////////////////
// CListCtrlEx window
enum EHighlight {HIGHLIGHT_NORMAL, HIGHLIGHT_ALLCOLUMNS, HIGHLIGHT_ROW};

class CListCtrlEx : public CListCtrl
{
// Construction
public:
	CListCtrlEx();

// Attributes
public:
	int SetHighlightType(EHighlight hilite);
// Operations
public:
	int AddItem( int nImage, LPCTSTR pszText, ... );
	BOOL SetHeaders( UINT uiStringID );
	BOOL SetHeaders(LPCTSTR heads);
	void Sort( int nType = 0 );

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CListCtrlEx)
	protected:
	virtual void PreSubclassWindow();
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetBgImageDC(HDC hDC, int nWidth, int nHeight);
	void SetBgColor(COLORREF crBgColor);
	void SetUser( long nUin );
	int FindItem( CString &str, int nCol = 0 );
	int FindItem( long nUin );
	virtual ~CListCtrlEx();

	// Generated message map functions
protected:
	void SetMemDC();
	void RepaintSelectedItems();
	BOOL SortNumericItems( int nCol, BOOL bAscending, int low = 0, int high = -1 );
	BOOL SortTextItems( int nCol, BOOL bAscending, int low = 0, int high = -1 );

	//{{AFX_MSG(CListCtrlEx)
	afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnMove(int x, int y);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
private:
	HDC			m_dcMem;
	HDC			m_dcBack;
	HBITMAP		m_bmpMem;
	HFONT		m_font;
	CHeaderCtrlEx	m_HeaderCtrl;
	COLORREF	m_crBgColor;
	CRect		m_rcWin;
	long		m_nUin;
	int			m_nHighlight;
	int			m_nSortColumn;
	int			m_nSortType;
	int			m_nBackWidth;
	int			m_nBackHeight;
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_LISTCTRLEX_H__DFA9A34B_1296_40F7_8406_03D605C7B7F5__INCLUDED_)
